package com.xbao.dao;

import com.xbao.model.Org;
import com.xbao.model.OrgExample;
import java.util.List;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
@Mapper
public interface OrgMapper {
    @SelectProvider(type=OrgSqlProvider.class, method="countByExample")
    int countByExample(OrgExample example);

    @DeleteProvider(type=OrgSqlProvider.class, method="deleteByExample")
    int deleteByExample(OrgExample example);

    @Delete({
        "delete from org",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into org (id, ownid, ",
        "descs, createtime, ",
        "updatetime, tel, ",
        "address, logo, isdel)",
        "values (#{id,jdbcType=BIGINT}, #{ownid,jdbcType=BIGINT}, ",
        "#{descs,jdbcType=VARCHAR}, #{createtime,jdbcType=BIGINT}, ",
        "#{updatetime,jdbcType=BIGINT}, #{tel,jdbcType=VARCHAR}, ",
        "#{address,jdbcType=VARCHAR}, #{logo,jdbcType=VARCHAR}, #{isdel,jdbcType=INTEGER})"
    })
    int insert(Org record);

    @InsertProvider(type=OrgSqlProvider.class, method="insertSelective")
    int insertSelective(Org record);

    @SelectProvider(type=OrgSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="ownid", property="ownid", jdbcType=JdbcType.BIGINT),
        @Result(column="descs", property="descs", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.BIGINT),
        @Result(column="tel", property="tel", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="logo", property="logo", jdbcType=JdbcType.VARCHAR),
        @Result(column="isdel", property="isdel", jdbcType=JdbcType.INTEGER)
    })
    List<Org> selectByExample(OrgExample example);

    @Select({
        "select",
        "id, ownid, descs, createtime, updatetime, tel, address, logo, isdel",
        "from org",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="ownid", property="ownid", jdbcType=JdbcType.BIGINT),
        @Result(column="descs", property="descs", jdbcType=JdbcType.VARCHAR),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="updatetime", property="updatetime", jdbcType=JdbcType.BIGINT),
        @Result(column="tel", property="tel", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="logo", property="logo", jdbcType=JdbcType.VARCHAR),
        @Result(column="isdel", property="isdel", jdbcType=JdbcType.INTEGER)
    })
    Org selectByPrimaryKey(Long id);

    @UpdateProvider(type=OrgSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Org record, @Param("example") OrgExample example);

    @UpdateProvider(type=OrgSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Org record, @Param("example") OrgExample example);

    @UpdateProvider(type=OrgSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Org record);

    @Update({
        "update org",
        "set ownid = #{ownid,jdbcType=BIGINT},",
          "descs = #{descs,jdbcType=VARCHAR},",
          "createtime = #{createtime,jdbcType=BIGINT},",
          "updatetime = #{updatetime,jdbcType=BIGINT},",
          "tel = #{tel,jdbcType=VARCHAR},",
          "address = #{address,jdbcType=VARCHAR},",
          "logo = #{logo,jdbcType=VARCHAR},",
          "isdel = #{isdel,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Org record);
}